/**
 * Created by asus on 2018/10/23.
 */
$('.serves_btn i').mouseover(function(){
    var num=$(this).index();
    $('.serves_lunbo img').eq(num).addClass('add').siblings().removeClass("add")
    $('.serves_btn i').eq(num).addClass('active').siblings().removeClass('active')
})

  //加载更多
var oMore=document.getElementsByClassName("more")[0];
var noMore=document.getElementsByClassName("nomore")[0];
let  listdata=ajax("post","http://www.shouziliu.com/LTO/serve/");
let oBox=document.getElementById("back2");
// 处理数据
var i=2;
oMore.onclick=function(){
    let  listdata=ajax("post","http://www.shouziliu.com/LTO/serve/");
    listdata.then((data)=>{
        let newData= JSON.parse(data).feedback;
        newData.forEach((item,index)=>{
            if(index>=i && index<=i+1){
                let oDIV=document.createElement("div");
                oDIV.innerHTML=`
         <div class="back_rong">
            <div class="back_bg">
               <div class="back_tu1">
                  <img src="img/tp/${item.tupian}" alt="" class="list1">
               </div>
               <div class="back_cont">
                   <p class="back_top">${item.name}</p>
                   <p class="back_top">${item.from}</p>
                   <p>${item.cont}</p>
               </div>
             </div>
         </div>
`;
                oBox.appendChild(oDIV)
            }
        });
        i+=2;
        if(i>=newData.length){
            oMore.style.display='none';
            noMore.style.display='block';
        }
    })
};

